package com.park.common.poo;

import com.park.common.constant.IDBConstant;
import com.park.common.constant.IPlatformConstant;

import javax.persistence.*;

import java.math.BigDecimal;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Created by Administrator on 2017-04-30.
 */
@Entity
@Table(name = "user_operator", schema = "", catalog = "totem")
public class UserOperator {
    private Integer id;
    private String operatorName;
    private String operatorMobile;
    private String headImg = IPlatformConstant.DEF_IMG_HEAD; //默认头像
    private String status = IDBConstant.LOGIC_STATUS_YES;
    private String createTime;
    private String updateTime;
    private String operatorType = IDBConstant.LOGIC_STATUS_OTHER;
    private Integer meritPoint = 0;
    private String openId;
    private String operatorPwd;
    private String passSalt;
    private String passHash;
    private String lastSignDate;
    private String superior;
    private String no;
    private BigDecimal commission = new BigDecimal(0);

    @Transient
    private String flag;

    public UserOperator() {
    }

    public UserOperator(Integer id, String operatorName, String no, String operatorMobile, String superior) {
        this.id = id;
        this.operatorName = operatorName;
        this.no = no;
        this.operatorMobile = operatorMobile;
        this.superior = superior;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "operatorName")
    public String getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }

    @Basic
    @Column(name = "operatorMobile")
    public String getOperatorMobile() {
        return operatorMobile;
    }

    public void setOperatorMobile(String operatorMobile) {
        this.operatorMobile = operatorMobile;
    }

    @Basic
    @Column(name = "headImg")
    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    @Basic
    @Column(name = "status")
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "createTime")
    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "updateTime")
    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    @Basic
    @Column(name = "operatorType")
    public String getOperatorType() {
        return operatorType;
    }

    public void setOperatorType(String operatorType) {
        this.operatorType = operatorType;
    }

    @Basic
    @Column(name = "meritPoint")
    public Integer getMeritPoint() {
        return meritPoint;
    }

    public void setMeritPoint(Integer meritPoint) {
        this.meritPoint = meritPoint;
    }

    @Basic
    @Column(name = "openId")
    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserOperator that = (UserOperator) o;

        if (id != that.id) return false;
        if (operatorName != null ? !operatorName.equals(that.operatorName) : that.operatorName != null) return false;
        if (operatorMobile != null ? !operatorMobile.equals(that.operatorMobile) : that.operatorMobile != null)
            return false;
        if (headImg != null ? !headImg.equals(that.headImg) : that.headImg != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false;
        if (operatorType != null ? !operatorType.equals(that.operatorType) : that.operatorType != null) return false;
        if (meritPoint != null ? !meritPoint.equals(that.meritPoint) : that.meritPoint != null) return false;
        if (openId != null ? !openId.equals(that.openId) : that.openId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (operatorName != null ? operatorName.hashCode() : 0);
        result = 31 * result + (operatorMobile != null ? operatorMobile.hashCode() : 0);
        result = 31 * result + (headImg != null ? headImg.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (operatorType != null ? operatorType.hashCode() : 0);
        result = 31 * result + (meritPoint != null ? meritPoint.hashCode() : 0);
        result = 31 * result + (openId != null ? openId.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "operatorPwd")
    public String getOperatorPwd() {
        return operatorPwd;
    }

    public void setOperatorPwd(String operatorPwd) {
        this.operatorPwd = operatorPwd;
    }

    @Basic
    @Column(name = "passSalt")
    public String getPassSalt() {
        return passSalt;
    }

    public void setPassSalt(String passSalt) {
        this.passSalt = passSalt;
    }

    @Basic
    @Column(name = "passHash")
    public String getPassHash() {
        return passHash;
    }

    public void setPassHash(String passHash) {
        this.passHash = passHash;
    }

    @Basic
    @Column(name = "lastSignDate")
    public String getLastSignDate() {
        return lastSignDate;
    }

    public void setLastSignDate(String lastSignDate) {
        this.lastSignDate = lastSignDate;
    }

    @Basic
    @Column(name = "superior")
    public String getSuperior() {
        return superior;
    }

    public void setSuperior(String superior) {
        this.superior = superior;
    }

    @Basic
    @Column(name = "no")
    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    @Basic
    @Column(name = "commission")
    public BigDecimal getCommission() {
        return commission;
    }

    public void setCommission(BigDecimal commission) {
        this.commission = commission;
    }

    @Transient
    public String getFlag() {
        return flag;
    }

    @Transient
    public void setFlag(String flag) {
        this.flag = flag;
    }
}
